//
//  UIImageExtend.m
//  xWeibo
//
//  Created by alvis mac on 8/1/15.
//  Copyright (c) 2015 alvis. All rights reserved.
//

#import "UIImageExtend.h"
#import "AyDefine.h"


@implementation UIImage(UIImageExtend)




+ (UIImage *)imageWithName:(NSString *)name{
    if (iOS7) {
        NSString *newName = [name stringByAppendingString:@"_os7"];
        UIImage *image = [UIImage imageNamed:newName];
        if (image == nil) {
            image = [UIImage imageNamed:name];
        }
        return image;
    }
    
    return [UIImage imageNamed:name];


}

+ (UIImage *)resizedImageWithName:(NSString *)name{
    return [self resizedImageWithName:name left:0.5 top:0.5];
}

+ (UIImage *)resizedImageWithName:(NSString *)name left:(CGFloat)left top:(CGFloat)top{
    UIImage *image = [self imageWithName:name];
    return [image stretchableImageWithLeftCapWidth:image.size.width * left topCapHeight:image.size.height * top];
}


@end
